<template>
  <div class="step5">
    <el-form :rules="FormRules" ref="dataForm" :model="Form" label-width="200px" v-loading="listLoading">
      <el-form-item>
        <div class="tit">
          <span>验证记录</span>
        </div>
      </el-form-item>
      <el-row>
        <el-col :span="16">
          <el-form-item label="选择报告模板：" prop="reportmodel">
            <el-select v-model="Form.reportmodel" placeholder="选择报告模板" :disabled="checkPermission(['engineer'])? false : true">
              <el-option v-for="item in reportModelOptions" :key="item.name" :label="item.name" :value="item.rid"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="测试时间：" prop="acttesttime">
            <el-input
              v-model="Form.acttesttime"
              placeholder="请输入测试时间"
              :style="{width:'220px'}"
              :disabled="checkPermission(['engineer'])? false : true"
            />
          </el-form-item>
          <el-form-item label="验证设备编号：" prop="devicecode">
            <el-input
              v-model="Form.devicecode"
              placeholder="请输入验证设备编号"
              :style="{width:'220px'}"
              :disabled="checkPermission(['engineer'])? false : true"
            />
          </el-form-item>
          <el-form-item label="确认对象各项参数时间：" prop="confirmdate">
            <el-date-picker type="datetime" placeholder="请选择时间" v-model="Form.confirmdate" :disabled="checkPermission(['engineer'])? false : true"/>
          </el-form-item>
          <el-form-item label="依照要求安装测点时间：" prop="installdate">
            <el-date-picker type="datetime" placeholder="请选择时间" v-model="Form.installdate" :disabled="checkPermission(['engineer'])? false : true"/>
          </el-form-item>
          <el-form-item label="关闭箱门验证开始时间：" prop="closedate">
            <el-date-picker type="datetime" placeholder="请选择时间" v-model="Form.closedate" :disabled="checkPermission(['engineer'])? false : true"/>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <div class="imgbox">
            <img v-preview="type1Img" :src="type1Img" preview-nav-enable="true" preview-title-enable="true">
            <p>现场操作记录表单</p>
          </div>
        </el-col>
      </el-row>
      <el-form-item>
        <div class="tit">
          <span>蓄冷剂配置方式</span>
        </div>
      </el-form-item>

      <el-form-item label="蓄冷环境温度：">
        <span>
          <el-input-number
            v-model="Form.freezingenvlowtemperature"
            :precision="2"
            :step="0.1"
            label="最低温度："
            :disabled="checkPermission(['engineer'])? false : true"
          />&nbsp;℃
        </span>
        <span>到</span>
        <span>
          <el-input-number
            v-model="Form.freezingenvhightemperature"
            :precision="2"
            :step="0.1"
            label="最高温度："
            :disabled="checkPermission(['engineer'])? false : true"
          />&nbsp;℃
        </span>
      </el-form-item>

      <el-form-item label="蓄冷时长：">
        <el-input-number
          v-model="Form.freezingtime"
          :precision="1"
          :step="0.1"
          label="蓄冷时长："
          :disabled="checkPermission(['engineer'])? false : true"
        />&nbsp;h
      </el-form-item>
      <el-form-item label="释冷环境温度：">
        <span>
          <el-input-number
            v-model="Form.releaseenvlowtemperature"
            :precision="2"
            :step="0.1"
            label="最低温度："
            :disabled="checkPermission(['engineer'])? false : true"
          />&nbsp;℃
        </span>
        <span>到</span>
        <span>
          <el-input-number
            v-model="Form.releaseenvhightemperature"
            :precision="2"
            :step="0.1"
            label="最高温度："
            :disabled="checkPermission(['engineer'])? false : true"
          />&nbsp;℃
        </span>
      </el-form-item>
      <el-form-item label="释冷时长：" prop="releasetime">
        <el-input-number v-model="Form.releasetime" :precision="1" :step="0.1" label="释冷时长：" :disabled="checkPermission(['engineer'])? false : true"/>&nbsp;min
      </el-form-item>
      <el-form-item label="蓄冷剂的摆放：">
        <el-select
          v-model="refrigerantarrangement"
          placeholder="选择文字模板"
          @change="refrigerantarrangementChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in textModelOptions" :key="item.textModel" :label="item.name" :value="item.textModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="refrigerantarrangement">
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="Form.refrigerantarrangement"
          :disabled="checkPermission(['engineer'])? false : true"
        ></el-input>
      </el-form-item>
      <el-form-item label="蓄冷剂的摆放：" prop="refrigerantarrangementpic">
        <el-select
          v-model="Form.refrigerantarrangementpic"
          placeholder="选择图片模板"
          @change="refrigerantarrangementpicChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in picModelOptions" :key="item.picModel" :label="item.name" :value="item.picModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <img :src="arrangementpic" width="250">
        <img v-if="arrangementpic ==''" :src="defaultImg" width="250">
      </el-form-item>
      <el-form-item>
        <div class="tit">
          <span>实际验证测点分布对应测点编号及位置关系</span>
        </div>
      </el-form-item>
      <el-row>
        <el-col :span="12">
          <div class="imgbox1" style="float:right">
            <div class="img">
              <img v-preview="type2Img" :src="type2Img" preview-nav-enable="true" preview-title-enable="true">
            </div>
            <div class="title">实际验证测点分布图</div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="imgbox1">
            <div class="img">
              <img v-preview="type3Img" :src="type3Img" preview-nav-enable="true" preview-title-enable="true">
            </div>
            <div class="title">现场验证布点草图</div>
          </div>
        </el-col>
      </el-row>
      <div class="tip">注：传感器编号需与上传文件一致</div>
      <el-row>
        <el-col :span="8" v-for="(item,index) in Form.level" :key="index" v-loading="codeLoading">
          <el-form-item :label="`标号${item.code}测点位置对应编号`" :prop="`level.${index}.sensorCode`" :rules="FormRules.levelNo">
            <el-input
              :style="{width:'110px'}"
              v-model="item.sensorCode"
              :placeholder="item.name"
              :disabled="checkPermission(['engineer'])? false : true"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-form-item>
        <div class="tit">
          <span>验证数据分析</span>
        </div>
      </el-form-item>
      <el-form-item label="验证结果：">
        <el-select
          v-model="verificationresult"
          placeholder="选择文字模板"
          @change="verificationresultChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in textModelOptions" :key="item.textModel" :label="item.name" :value="item.textModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="verificationresult">
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="Form.verificationresult"
          :disabled="checkPermission(['engineer'])? false : true"
        ></el-input>
      </el-form-item>
      <el-form-item label="开箱时长：" prop="kaiguanmenopentime">
        <el-input-number v-model="Form.kaiguanmenopentime" :step="1" :disabled="checkPermission(['engineer'])? false : true"/>&nbsp;min
      </el-form-item>
      <el-form-item label="开箱测试结果分析：">
        <el-select
          v-model="openboxanalysisresult"
          placeholder="选择文字模板"
          @change="openboxanalysisresultChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in textModelOptions" :key="item.textModel" :label="item.name" :value="item.textModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="openboxanalysisresult">
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="Form.openboxanalysisresult"
          :disabled="checkPermission(['engineer'])? false : true"
        ></el-input>
      </el-form-item>
      <el-form-item label="验证中心点温度设定值：" prop="centersettemperature">
        <el-input-number v-model="Form.centersettemperature" :precision="2" :step="0.1" :disabled="checkPermission(['engineer'])? false : true"/>&nbsp;℃
      </el-form-item>
      <el-form-item label="极端环境情况：">
        <el-select
          v-model="extremeenvcondition"
          placeholder="选择文字模板"
          @change="extremeenvconditionChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in textModelOptions" :key="item.textModel" :label="item.name" :value="item.textModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="extremeenvcondition">
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="Form.extremeenvcondition"
          :disabled="checkPermission(['engineer'])? false : true"
        ></el-input>
      </el-form-item>
      <el-form-item label="日平均气温最高：" prop="daylowtemperature">
        <el-input-number v-model="Form.daylowtemperature" :precision="2" :step="0.1" :disabled="checkPermission(['engineer'])? false : true"/>&nbsp;℃
      </el-form-item>
      <el-form-item label="日平均气温最低：" prop="dayhightemperature">
        <el-input-number v-model="Form.dayhightemperature" :precision="2" :step="0.1" :disabled="checkPermission(['engineer'])? false : true"/>&nbsp;℃
      </el-form-item>
      <el-form-item label="药品合理存放区域：" prop="storageareapic">
        <el-select
          v-model="Form.storageareapic"
          placeholder="选择图片模板"
          @change="storageareapicChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in picModelOptions" :key="item.picModel" :label="item.name" :value="item.picModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <img :src="storageareapic" width="250">
        <img v-if="storageareapic==''" :src="defaultImg" width="250">
      </el-form-item>
      <el-form-item>
        <div class="tit">
          <span>验证结论</span>
        </div>
      </el-form-item>
      <el-form-item label="温度监测设备放置位置：">
        <el-select
          v-model="equipmentlocationconfirm"
          placeholder="选择文字模板"
          @change="equipmentlocationconfirmChange"
          :disabled="checkPermission(['engineer'])? false : true"
        >
          <el-option v-for="item in textModelOptions" :key="item.textModel" :label="item.name" :value="item.textModel"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="equipmentlocationconfirm">
        <el-input
          :disabled="checkPermission(['engineer'])? false : true"
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="Form.equipmentlocationconfirm"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button :disabled="checkPermission(['engineer'])? false : true" v-if="saveShow" @click="saveForm('dataForm')">保存</el-button>
        <!-- <el-button type="primary" :disabled="checkPermission(['engineer'])? false : true" @click="submitForm('dataForm')">提交</el-button> -->
        <el-button type="warning" @click="generateForm('dataForm')" :loading="exportLoading || countLoading">{{exportButton}}</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import checkPermission from "@/utils/permission"; // 权限判断函数
import {
  getProjectContentPic,
  getProjectContentInfo,
  projectContentIncubatorUpdate,
  getDistributionInfo,
  DistributionUpdate
} from "@/api/projectContent";
import { getTaskData } from "@/api/task";
import { getPicModelList } from "@/api/pictureModel";
import { getTextModelList } from "@/api/textModel";
import { getPlanModelPic } from "@/api/projectContent";
import { getReportList } from "@/api/report";
import {
  getProjectData,
  generateReport,
  getGenerateStatus,
  getGenerateFile,
  resetGenerateStatus,
  updateProjectState
} from "@/api/project";
export default {
  name: "incubatorStep5",
  props: ["getId"],
  data() {
    return {
      defaultImg: require("@/assets/noimg.jpg"),
      listLoading: false,
      codeLoading: false,
      exportstatus: 0,
      countLoading: false,
      exportButton: "生成报告",
      saveShow: true,
      textModelOptions: [],
      reportModelOptions: [],
      picModelOptions: [],
      arrangementpic: "",
      storageareapic: "",
      refrigerantarrangement: null,
      openboxanalysisresult: null,
      verificationresult: null,
      extremeenvcondition: null,
      equipmentlocationconfirm: null,
      type1Img: "",
      type2Img: "",
      type3Img: "",
      customerId: null,
      Form: {
        level: [],
        reportmodel: null, //报告模板
        acttesttime: "",
        devicecode: "", // 验证设备编号
        confirmdate: new Date(), // 确认验证对象各项参数时间
        installdate: new Date(), // 依据要求安装验证测点时间
        closedate: new Date(), // 关闭保温箱门，验证开始时间
        freezingenvlowtemperature: 0, // 蓄冷环境温度 低温
        freezingenvhightemperature: 0, // 蓄冷环境温度 高温
        freezingtime: 0, // 蓄冷时长
        releaseenvlowtemperature: 0, // 释冷环境温度 低温
        releaseenvhightemperature: 0, // 释冷环境温度 高温
        releasetime: 0, // 释冷时长
        refrigerantarrangement: "", // 蓄冷剂的摆放
        refrigerantarrangementpic: null, // 蓄冷剂的摆放图
        kaiguanmenopentime: 0, //开箱时长
        openboxanalysisresult: "", // 开箱测试结果分析
        centersettemperature: 0, // 验证中心点温度设定值
        daylowtemperature: 0, // 日平均气温最高
        dayhightemperature: 0, // 日平均气温最低
        verificationresult: "", // 验证结果
        extremeenvcondition: "", // 极端环境情况
        storageareapic: null, // 药品合理存放区域图
        equipmentlocationconfirm: "" // 温度自动监测设备放置位置确认
      },
      FormRules: {
        reportmodel: [
          { required: true, message: "请选择报告模板", trigger: "change" }
        ],
        levelNo: [
          { required: true, message: "请填写位置对应编号", trigger: "blur" }
        ],
        acttesttime: [
          { required: true, message: "请填写测试时间", trigger: "blur" }
        ],
        devicecode: [
          { required: true, message: "请填写验证设备编号", trigger: "blur" }
        ],
        confirmdate: [
          {
            type: "date",
            required: true,
            message: "请填写确认验证对象各项参数时间",
            trigger: "change"
          }
        ],
        installdate: [
          {
            type: "date",
            required: true,
            message: "请填写依据要求安装验证测点时间",
            trigger: "change"
          }
        ],
        closedate: [
          {
            type: "date",
            required: true,
            message: "请填写关闭保温箱门，验证开始时间",
            trigger: "change"
          }
        ],
        refrigerantarrangement: [
          {
            required: true,
            message: "请填写蓄冷剂的摆放文字描述",
            trigger: "blur"
          }
        ],
        refrigerantarrangementpic: [
          { required: true, message: "请选择蓄冷剂的摆放图", trigger: "change" }
        ],
        openboxanalysisresult: [
          { required: true, message: "请填写开箱测试结果分析", trigger: "blur" }
        ],
        verificationresult: [
          { required: true, message: "请填写验证结果", trigger: "blur" }
        ],
        extremeenvcondition: [
          { required: true, message: "请填写极端环境情况", trigger: "blur" }
        ],
        storageareapic: [
          {
            required: true,
            message: "请选择药品合理存放区域图片",
            trigger: "change"
          }
        ],
        equipmentlocationconfirm: [
          {
            required: true,
            message: "请填写温度自动监测设备放置位置",
            trigger: "blur"
          }
        ]
      }
    };
  },
  computed: {
    exportLoading() {
      if (this.exportstatus == 1) {
        this.exportButton = "生成中，请稍候";
        return true;
      } else {
        this.exportButton = "生成报告";
        return false;
      }
    }
  },
  methods: {
    checkPermission,
    // 蓄冷剂的摆放选择
    refrigerantarrangementChange(val) {
      for (var text of this.textModelOptions) {
        if (val == text.textModel) {
          this.refrigerantarrangement = val;
          this.Form.refrigerantarrangement = text.content;
        }
      }
    },
    // 蓄冷剂的摆放图片选择
    refrigerantarrangementpicChange(val) {
      for (var picData of this.picModelOptions) {
        if (val == picData.picModel) {
          this.arrangementpic = picData.imgUrl;
        }
      }
    },
    // 开箱测试结果分析
    openboxanalysisresultChange(val) {
      for (var text of this.textModelOptions) {
        if (val == text.textModel) {
          this.Form.openboxanalysisresult = text.content;
        }
      }
    },
    // 验证结果
    verificationresultChange(val) {
      for (var text of this.textModelOptions) {
        if (val == text.textModel) {
          this.Form.verificationresult = text.content;
        }
      }
    },
    // 极端环境情况
    extremeenvconditionChange(val) {
      for (var text of this.textModelOptions) {
        if (val == text.textModel) {
          this.Form.extremeenvcondition = text.content;
        }
      }
    },
    // 药品合理存放区域
    storageareapicChange(val) {
      for (var picData of this.picModelOptions) {
        if (val == picData.picModel) {
          this.storageareapic = picData.imgUrl;
        }
      }
    },
    // 温度自动监测设备放置位置
    equipmentlocationconfirmChange(val) {
      for (var text of this.textModelOptions) {
        if (val == text.textModel) {
          this.Form.equipmentlocationconfirm = text.content;
        }
      }
    },

    //获取图片
    getImg() {
      let arr = [
        getProjectContentPic({ projectId: this.getId, typeId: 1 }),
        getPlanModelPic({ projectId: this.getId }),
        getProjectContentPic({ projectId: this.getId, typeId: 2 })
      ];
      Promise.all(arr)
        .then(result => {
          let [res1, res2, res3] = result; // 解构赋值
          res1.data == null
            ? (this.type1Img = this.defaultImg)
            : (this.type1Img = res1.data.url);
          res2.data == null
            ? (this.type2Img = this.defaultImg)
            : (this.type2Img = res2.data);
          res3.data == null
            ? (this.type3Img = this.defaultImg)
            : (this.type3Img = res3.data.url);
        })
        .catch(e => {
          console.log(e);
        });
    },

    //获取文字和图片模板列表
    async getModel() {
      this.listLoading = true;
      //获取主项目customerId
      const { data } = await getProjectData({ projectId: this.getId });
      const { tid } = data;
      const result = await getTaskData({ taskId: tid });
      const { customerId } = result.data;
      this.customerId = customerId;
      //获取报告,文字， 图片模板
      let arr = [
        getReportList({ customerId: this.customerId, deviceType: 1 }),
        getTextModelList({ customerId: this.customerId, deviceType: 1 }),
        getPicModelList({ customerId: this.customerId, deviceType: 1 })
      ];
      Promise.all(arr)
        .then(messages => {
          let [reportModel, TextModel, PicModel] = messages;
          this.reportModelOptions = reportModel.data;
          this.textModelOptions = TextModel.data.map(item => {
            return {
              textModel: item.id,
              name: item.name,
              content: item.content
            };
          });
          this.picModelOptions = PicModel.data.map(item => {
            return {
              picModel: item.id,
              name: item.name,
              imgUrl: item.url
            };
          });
          this.getProjectContent();
          this.listLoading = false;
        })
        .catch(err => {
          console.log(err);
        });
    },

    //获取布点信息
    async getDistribution() {
      this.codeLoading = true;
      const { data } = await getDistributionInfo({ projectId: this.getId });
      this.Form.level = data;
      console.log(this.Form.level)
      this.codeLoading = false;
    },

    //获取保温箱验证内容信息
    async getProjectContent() {
      const { data } = await getProjectContentInfo({ projectId: this.getId });
      for (const item of data) {
        this.Form[item.name] =
          item.genre == "point" || item.genre == "int"
            ? Number(item.value)
            : item.value;
        this.$nextTick(() => {
          const keyMap = [
            {
              key: "refrigerantarrangementpic",
              value: "arrangementpic"
            },
            {
              key: "storageareapic",
              value: "storageareapic"
            }
          ];
          for (const item of keyMap) {
            const { key, value } = item;
            for (const picData of this.picModelOptions) {
              const { picModel, imgUrl } = picData;
              if (this.Form[key] === picModel) {
                this[value] = imgUrl;
              }
            }
          }
        });
      }
    },

    //布点信息提交
    UpdateDistribution() {
      //布点信息更新
      let list = [];
      list = this.Form.level.map(item => {
        if (item.id == null) {
          //  新建位置布点关系 没有id
          return {
            positionId: item.pid,
            projectId: this.getId,
            sensorCode: item.sensorCode
          };
        } else {
          //  更新位置布点关系
          return {
            id: item.id,
            positionId: item.pid,
            projectId: this.getId,
            sensorCode: Number(item.sensorCode)
          };
        }
      });
      DistributionUpdate({ list })
        .then(_ => {
          this.getDistribution();
        })
        .catch(e => {
          console.log("布点信息提交失败", e);
        });
    },

    //保存--表格不做验证
    saveForm() {
      this.listLoading = true;
      this.Form.confirmdate = new Date(this.Form.confirmdate);
      this.Form.installdate = new Date(this.Form.installdate);
      this.Form.closedate = new Date(this.Form.closedate);
      let list1 = [];
      //将form对象转成数组
      for (const key of Object.keys(this.Form)) {
        if (key != "level")
          list1.push({
            projectId: this.getId,
            name: key,
            value: this.Form[key]
          });
      }
      projectContentIncubatorUpdate({ list: list1 })
        .then(response => {
          this.UpdateDistribution();
          this.getModel();
          this.listLoading = false;
          this.$notify({
            title: "成功",
            message: "保存成功",
            type: "success",
            duration: 2000
          });
        })
        .catch(e => {
          console.log("验证内容表单提交失败", e);
        });
    },

    //提交--表格做验证
    submitForm(formName) {
      this.listLoading = true;
      this.Form.confirmdate = new Date(this.Form.confirmdate);
      this.Form.installdate = new Date(this.Form.installdate);
      this.Form.closedate = new Date(this.Form.closedate);
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.$confirm("确认提交吗？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消"
          })
            .then(async () => {
              let list1 = [];
              //将form对象转成数组
              for (const key of Object.keys(this.Form)) {
                if (key != "level")
                  list1.push({
                    projectId: this.getId,
                    name: key,
                    value: this.Form[key]
                  });
              }
              await projectContentIncubatorUpdate({ list: list1 });
              //布点信息更新
              this.UpdateDistribution();
              this.getModel();
              this.listLoading = false;
              this.$notify({
                title: "成功",
                message: "表单提交成功",
                type: "success",
                duration: 2000
              });
              await updateProjectState({ pid: this.getId, state: 2 });
              this.$emit("changeState");
              this.saveShow = false;
            })
            .catch(() => {
              this.$message({
                type: "info",
                message: "已取消提交"
              });
            });
        }
      });
    },

    // 获取报告生成状态 res.data 0,暂时无法导出 1，生成中 2，生成完成
    async getExportStatus() {
      let { data } = await getGenerateStatus({ projectId: this.getId });
      let originexportstatus = this.exportstatus;
      this.exportstatus = data;
      if (originexportstatus != 2 && this.exportstatus == 2) {
        let { data } = await getGenerateFile({ projectId: this.getId });
        this.$confirm(`生成成功,立刻下载`, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消"
        })
          .then(() => {
            window.open(data);
            this.$message({
              type: "success",
              message: "下载成功"
            });
            resetGenerateStatus({ projectId: this.getId });
          })
          .catch(() => {
            resetGenerateStatus({ projectId: this.getId });
            this.$message({
              type: "info",
              message: "已取消下载"
            });
          });
      }
    },

    //生成--表格做验证
    generateForm(formName) {
      this.Form.confirmdate = new Date(this.Form.confirmdate);
      this.Form.installdate = new Date(this.Form.installdate);
      this.Form.closedate = new Date(this.Form.closedate);
      this.$refs[formName].validate(async valid => {
        if (valid) {
          this.listLoading = true;
          let list1 = [];
          //将form对象转成数组
          for (const key of Object.keys(this.Form)) {
            if (key != "level")
              list1.push({
                projectId: this.getId,
                name: key,
                value: this.Form[key]
              });
          }
          await projectContentIncubatorUpdate({ list: list1 });
          //布点信息更新
          this.UpdateDistribution();
          this.getModel();
          await updateProjectState({ pid: this.getId, state: 2 });
          this.$emit("changeState");
          this.listLoading = false;
          this.$confirm("确认生成报告吗？", "提示", {
            type: "warning"
          })
            .then(async () => {
              this.countLoading = true;
              await generateReport({ projectId: _this.getId });
              this.countLoading = false;
              this.exportstatus = 1;
              this.exportButton = "生成中，请稍侯";
            })
            .catch(() => {
              this.$message({
                type: "info",
                message: "已取消下载"
              });
            });
        }
      });
    }
  },

  created() {
    let _this = this;
    _this.getImg();
    _this.getDistribution();
    _this.getModel();
    _this.interval = setInterval(function() {
      _this.getExportStatus();
    }, 3000);
  },
  destroyed() {
    clearInterval(this.interval);
  }
};
</script>
<style lang="scss" scoped>
.step5 {
  .tit {
    border-bottom: 1px solid #ebeef5;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    margin-left: -200px;
    font-weight: 700;
  }
  .imgbox {
    width: 250px;
    text-align: center;
    line-height: 30px;
    box-shadow: 0 6px 18px 0 rgba(232, 237, 250, 0.5);
    img {
      width: 100%;
      border: 1px solid #eee;
      cursor: pointer;
    }
  }
  .imgbox1 {
    float: left;
    width: 200px;
    height: 230px;
    margin-left: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 6px 18px 0 rgba(232, 237, 250, 0.5);
    .img {
      border: 1px solid #eee;
      width: 198px;
      height: 198px;
      overflow: hidden;
      cursor: pointer;
      img {
        width: 100%;
      }
    }
    .title {
      line-height: 30px;
      font-size: 14px;
    }
  }
  .labelWidth {
    width: 120px;
  }
}
.tip {
  font-size: 12px;
  text-align: center;
  padding: 20px;
}
</style>



